<template>
  <view>
    <!-- 轮播图区域 -->
    <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" circular="true" >
      <swiper-item v-for="(item,index) in swiperList" :key="index">
       <navigator class="swiper-item" :url="'/subpkg/goods_detail/goods_detail?goods_detail_id='+item.goodsDetailId">
         <image :src="item.image"></image>
       </navigator>
      </swiper-item>
    </swiper>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        swiperList: [],
      };
    },
    onLoad() {
      this.getSwiperList()
    },
    methods:{
      async getSwiperList(){
        const res = await uni.$http.get('/swipperImg/findAll')
        // const res = await $http.get('http://localhost:9000/wryz/swipperImg/findAll')
        if(res.statusCode != 200) return uni.showMsg()
        this.swiperList = res.data
      }
    }
  }
</script>

<style lang="scss">
  swiper {
    height: 330rpx;
    .swiper-item,image {
      width: 100%;
      height: 100%;
    }
  }
</style>
